Skip to content

Commit bc0c2de

Browse files
committed
test: make TextInputExample compatible with react-native-macos
1 parent 3cb6972 commit bc0c2de

1 file changed

Lines changed: 37 additions & 68 deletions

File tree

RNTester/js/TextInputExample.macos.js

Lines changed: 37 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'use strict';
1212

1313
const Button = require('Button');
14-
const InputAccessoryView = require('InputAccessoryView');
14+
// const InputAccessoryView = require('InputAccessoryView');
1515
const React = require('react');
1616
const ReactNative = require('react-native');
1717
const {Text, TextInput, View, StyleSheet, Slider, Switch, Alert} = ReactNative;
@@ -91,37 +91,37 @@ class TextEventsExample extends React.Component<{}, $FlowFixMeState> {
9191
}
9292
}
9393

94-
class TextInputAccessoryViewExample extends React.Component<{}, *> {
95-
/* $FlowFixMe(>=0.85.0 site=react_native_ios_fb) This comment suppresses an
96-
* error found when Flow v0.85 was deployed. To see the error, delete this
97-
* comment and run Flow. */
98-
constructor(props) {
99-
super(props);
100-
this.state = {text: 'Placeholder Text'};
101-
}
102-
103-
render() {
104-
const inputAccessoryViewID = 'inputAccessoryView1';
105-
return (
106-
<View>
107-
<TextInput
108-
style={styles.default}
109-
inputAccessoryViewID={inputAccessoryViewID}
110-
onChangeText={text => this.setState({text})}
111-
value={this.state.text}
112-
/>
113-
<InputAccessoryView nativeID={inputAccessoryViewID}>
114-
<View style={{backgroundColor: 'white'}}>
115-
<Button
116-
onPress={() => this.setState({text: 'Placeholder Text'})}
117-
title="Reset Text"
118-
/>
119-
</View>
120-
</InputAccessoryView>
121-
</View>
122-
);
123-
}
124-
}
94+
// class TextInputAccessoryViewExample extends React.Component<{}, *> {
95+
// /* $FlowFixMe(>=0.85.0 site=react_native_ios_fb) This comment suppresses an
96+
// * error found when Flow v0.85 was deployed. To see the error, delete this
97+
// * comment and run Flow. */
98+
// constructor(props) {
99+
// super(props);
100+
// this.state = {text: 'Placeholder Text'};
101+
// }
102+
//
103+
// render() {
104+
// const inputAccessoryViewID = 'inputAccessoryView1';
105+
// return (
106+
// <View>
107+
// <TextInput
108+
// style={styles.default}
109+
// inputAccessoryViewID={inputAccessoryViewID}
110+
// onChangeText={text => this.setState({text})}
111+
// value={this.state.text}
112+
// />
113+
// <InputAccessoryView nativeID={inputAccessoryViewID}>
114+
// <View style={{backgroundColor: 'white'}}>
115+
// <Button
116+
// onPress={() => this.setState({text: 'Placeholder Text'})}
117+
// title="Reset Text"
118+
// />
119+
// </View>
120+
// </InputAccessoryView>
121+
// </View>
122+
// );
123+
// }
124+
// }
125125

126126
class RewriteExample extends React.Component<$FlowFixMeProps, any> {
127127
/* $FlowFixMe(>=0.85.0 site=react_native_ios_fb) This comment suppresses an
@@ -206,49 +206,25 @@ class RewriteExampleKana extends React.Component<$FlowFixMeProps, any> {
206206
}
207207
}
208208

209-
class SecureEntryExample extends React.Component<$FlowFixMeProps, any> {
209+
class PasswordExample extends React.Component<$FlowFixMeProps, any> {
210210
/* $FlowFixMe(>=0.85.0 site=react_native_ios_fb) This comment suppresses an
211211
* error found when Flow v0.85 was deployed. To see the error, delete this
212212
* comment and run Flow. */
213213
constructor(props) {
214214
super(props);
215-
this.state = {
216-
text: '',
217-
password: '',
218-
isSecureTextEntry: true,
219-
};
215+
this.state = {text: ''};
220216
}
221217
render() {
222218
return (
223219
<View>
224220
<TextInput
225-
secureTextEntry={true}
221+
password={true}
226222
style={styles.default}
227223
defaultValue="abc"
228224
onChangeText={text => this.setState({text})}
229225
value={this.state.text}
230226
/>
231227
<Text>Current text is: {this.state.text}</Text>
232-
<View
233-
style={{
234-
flex: 1,
235-
flexDirection: 'row',
236-
}}>
237-
<TextInput
238-
style={styles.default}
239-
defaultValue="cde"
240-
onChangeText={text => this.setState({password: text})}
241-
secureTextEntry={this.state.isSecureTextEntry}
242-
value={this.state.password}
243-
/>
244-
<Switch
245-
onValueChange={value => {
246-
this.setState({isSecureTextEntry: value});
247-
}}
248-
style={{marginLeft: 4}}
249-
value={this.state.isSecureTextEntry}
250-
/>
251-
</View>
252228
</View>
253229
);
254230
}
@@ -762,9 +738,9 @@ exports.examples = [
762738
},
763739
},
764740
{
765-
title: 'Secure text entry',
741+
title: 'Password',
766742
render: function() {
767-
return <SecureEntryExample />;
743+
return <PasswordExample />;
768744
},
769745
},
770746
{
@@ -937,13 +913,6 @@ exports.examples = [
937913
multiline={true}
938914
style={styles.multiline}
939915
/>
940-
<TextInput
941-
defaultValue="uneditable multiline text input with phone number detection: 88888888."
942-
editable={false}
943-
multiline={true}
944-
style={styles.multiline}
945-
dataDetectorTypes="phoneNumber"
946-
/>
947916
</View>
948917
);
949918
},

0 commit comments

Comments
 (0)