Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"@types/invariant": "^2.2.35",
"@types/jest": "^26.0.0",
"@types/react": "^16.9.19",
"@types/react-native": "0.62.13",
"@types/react-native": "^0.69.5",
"babel-eslint": "^10.0.0",
"babel-jest": "^24.9.0",
"commitlint": "^11.0.0",
Expand All @@ -127,7 +127,7 @@
"pod-install": "^0.1.0",
"prettier": "^2.0.5",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native": "^0.69.4",
"react-native-builder-bob": "^0.18.0",
"react-test-renderer": "16.10.2",
"release-it": "^14.2.2",
Expand Down
64 changes: 0 additions & 64 deletions src/components/affix/index.js

This file was deleted.

66 changes: 66 additions & 0 deletions src/components/affix/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import React from 'react';
import {
Animated,
ColorValue,
StyleProp,
StyleSheet,
TextStyle,
ViewStyle,
} from 'react-native';

interface AffixProps {
labelAnimation: Animated.Value;
style?: StyleProp<TextStyle>;
children?: string;
type: 'prefix' | 'suffix';
fontSize: number;
color: ColorValue;
}

const Affix = ({
labelAnimation,
style,
children,
type,
fontSize,
color,
}: AffixProps) => {
let containerStyle: Animated.AnimatedProps<StyleProp<ViewStyle>> = {
height: fontSize * 1.5,
opacity: labelAnimation,
};

let textStyle: StyleProp<TextStyle> = {
includeFontPadding: false,
textAlignVertical: 'top',
fontSize,
color,
};

switch (type) {
case 'prefix':
containerStyle.paddingRight = 8;
textStyle.textAlign = 'left';
break;

case 'suffix':
containerStyle.paddingLeft = 8;
textStyle.textAlign = 'right';
break;
}

return (
<Animated.View style={[styles.container, containerStyle]}>
<Animated.Text style={[style, textStyle]}>{children}</Animated.Text>
</Animated.View>
);
};

export default Affix;

const styles = StyleSheet.create({
container: {
top: 2,
justifyContent: 'center',
},
});
8 changes: 0 additions & 8 deletions src/components/affix/styles.js

This file was deleted.

36 changes: 0 additions & 36 deletions src/components/counter/index.js

This file was deleted.

53 changes: 53 additions & 0 deletions src/components/counter/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import {
ColorValue,
StyleProp,
StyleSheet,
Text,
TextStyle,
} from 'react-native';

interface CounterProps {
count: number;
limit?: number;
baseColor: ColorValue;
errorColor: ColorValue;
style?: StyleProp<TextStyle>;
}

const Counter = ({
count,
limit,
baseColor,
errorColor,
style,
}: CounterProps) => {
if (!limit) {
return null;
}

return (
<Text
style={[
styles.text,
style,
{
color: count > limit ? errorColor : baseColor,
},
]}
>{`${count} / ${limit}`}</Text>
);
};

export default Counter;

const styles = StyleSheet.create({
text: {
fontSize: 12,
lineHeight: 16,
textAlign: 'right',
backgroundColor: 'transparent',
paddingVertical: 2,
marginLeft: 8,
},
});
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/counter/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'react-native';
import React from 'react';
import renderer from 'react-test-renderer';

import Counter from '.';
import Counter from './index';

/* eslint-env jest */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Line from '../line';
import Label from '../label';
import Affix from '../affix';
import Helper from '../helper';
import Counter from '../counter';
import Counter from '../counter/index.ts';

import styles from './styles';

Expand Down Expand Up @@ -597,6 +597,7 @@ export default class TextField extends PureComponent {
} = this.props;

let props = this.inputProps();
console.log('props', props);
let inputStyle = this.inputStyle();

return (
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading