mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
cd9adda651
Summary: The files in `ReactAndroid/src/androidTest/js` use Haste names; this commit migrates them to use path-based imports. This helps us move RN towards standard path-based requires. All the requires in `androidTest` have been rewritten to use relative requires. [General] [Changed] - Migrate "androidTest" JS from Haste to path-based requires Pull Request resolved: https://github.com/facebook/react-native/pull/24813 Differential Revision: D15318108 Pulled By: cpojer fbshipit-source-id: dddc68f992b8dea48afb01fd4481bd5b846231ca
90 lines
2.2 KiB
JavaScript
90 lines
2.2 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const React = require('react');
|
|
const {NativeModules, Picker, View} = require('react-native');
|
|
const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge');
|
|
|
|
const {Recording: RecordingModule} = NativeModules;
|
|
const Item = Picker.Item;
|
|
|
|
let appInstance;
|
|
|
|
class PickerAndroidTestApp extends React.Component {
|
|
state = {
|
|
selected: 1,
|
|
mode: 'dropdown',
|
|
style: {},
|
|
};
|
|
|
|
UNSAFE_componentWillMount() {
|
|
appInstance = this;
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<View collapsable={false}>
|
|
<Picker
|
|
mode="dialog"
|
|
prompt="prompt"
|
|
style={this.state.style}
|
|
selectedValue={this.state.selected}
|
|
onValueChange={this.onValueChange}>
|
|
<Item label="item1" color="#ff0000" value={0} />
|
|
<Item label="item2" color="#00ff00" value={1} />
|
|
<Item label="item3" color="#0000ff" value={2} />
|
|
</Picker>
|
|
<Picker mode={this.state.mode}>
|
|
<Item label="item1" />
|
|
<Item label="item2" />
|
|
</Picker>
|
|
<Picker enabled={false}>
|
|
<Item label="item1" />
|
|
<Item label="item2" />
|
|
</Picker>
|
|
<Picker
|
|
mode="dropdown"
|
|
selectedValue={this.state.selected}
|
|
onValueChange={this.onValueChange}>
|
|
<Item label="item in sync 1" value={0} />
|
|
<Item label="item in sync 2" value={1} />
|
|
<Item label="item in sync 3" value={2} />
|
|
</Picker>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
onValueChange = value => {
|
|
this.setState({selected: value});
|
|
RecordingModule.recordSelection(value);
|
|
};
|
|
}
|
|
|
|
const PickerAndroidTestModule = {
|
|
PickerAndroidTestApp: PickerAndroidTestApp,
|
|
selectItem: function(value) {
|
|
appInstance.setState({selected: value});
|
|
},
|
|
setMode: function(mode) {
|
|
appInstance.setState({mode: mode});
|
|
},
|
|
setPrimaryColor: function(color) {
|
|
appInstance.setState({style: {color}});
|
|
},
|
|
};
|
|
|
|
BatchedBridge.registerCallableModule(
|
|
'PickerAndroidTestModule',
|
|
PickerAndroidTestModule,
|
|
);
|
|
|
|
module.exports = PickerAndroidTestModule;
|