Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up some warnings #808

Merged
Merged
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
5 changes: 3 additions & 2 deletions packages/core/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
LayoutChangeEvent,
TextInput as NativeTextInput,
Keyboard,
Platform,
} from "react-native";
import { useSafeAreaInsets } from "react-native-safe-area-context";

Expand Down Expand Up @@ -188,14 +189,14 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
Animated.timing(labeled, {
toValue: 0,
duration: BLUR_ANIMATION_DURATION,
useNativeDriver: true,
useNativeDriver: Platform.OS !== "web",
}).start();
} else {
// _restoreLabel();
Animated.timing(labeled, {
toValue: 1,
duration: FOCUS_ANIMATION_DURATION,
useNativeDriver: true,
useNativeDriver: Platform.OS !== "web",
}).start();
}
}, [value, focused, placeholder1, labeled]);
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,13 @@ type Props = {
class Text extends React.Component<Props> {
_root: any;

state: any = {
nativeProps: {},
};

setNativeProps(args: TextProps) {
this.state.nativeProps = args || {};
}

render() {
const { style, ...rest } = this.props;
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";

return (
<NativeText
{...rest}
{...this.state.nativeProps}
ref={(c) => {
this._root = c;
}}
Expand Down
18 changes: 3 additions & 15 deletions packages/core/src/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ViewStyle,
TextStyle,
LayoutChangeEvent,
Platform,
} from "react-native";
import { withTheme } from "../theming";
import type { Theme } from "../styles/DefaultTheme";
Expand Down Expand Up @@ -53,7 +54,6 @@ export type Props = {
IconSlot;

interface State {
nativeProps: any;
labeled: Animated.Value;
focused?: boolean;
placeholder?: string | undefined;
Expand All @@ -75,7 +75,6 @@ class TextField extends React.Component<Props, State> {
}

state: State = {
nativeProps: {},
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
focused: false,
placeholder: this.props.error ? this.props.placeholder : "",
Expand Down Expand Up @@ -158,14 +157,14 @@ class TextField extends React.Component<Props, State> {
Animated.timing(this.state.labeled, {
toValue: 1,
duration: FOCUS_ANIMATION_DURATION,
useNativeDriver: true,
useNativeDriver: Platform.OS !== "web",
}).start();

_minmizeLabel = () =>
Animated.timing(this.state.labeled, {
toValue: 0,
duration: BLUR_ANIMATION_DURATION,
useNativeDriver: true,
useNativeDriver: Platform.OS !== "web",
}).start();

_handleFocus = () => {
Expand Down Expand Up @@ -206,15 +205,6 @@ class TextField extends React.Component<Props, State> {
}

_root: NativeTextInput | undefined = undefined;
/**
* @internal
*/
setNativeProps(args: Props) {
this.setState((state) => ({
...state,
nativeState: args || {},
}));
}

isFocused() {
return this._root && this._root.isFocused();
Expand Down Expand Up @@ -531,7 +521,6 @@ class TextField extends React.Component<Props, State> {
: this.props.placeholder,
placeholderTextColor: placeholderColor,
editable: !disabled && editable,
disabled: disabled || !editable,
selectionColor: activeColor,
multiline,
numberOfLines,
Expand All @@ -540,7 +529,6 @@ class TextField extends React.Component<Props, State> {
underlineColorAndroid: "transparent",
style: inputStyles,
...rest,
...this.state.nativeProps,
value: this.state.value,
})}
</View>
Expand Down