2017-04-27 18:49:50 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2017-04-27 18:49:50 +00:00
|
|
|
*
|
|
|
|
* @flow
|
|
|
|
* @providesModule SyncMethodTest
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react');
|
|
|
|
var ReactNative = require('react-native');
|
|
|
|
var { View } = ReactNative;
|
|
|
|
|
|
|
|
const {
|
|
|
|
TestModule,
|
2017-05-06 03:50:47 +00:00
|
|
|
RNTesterTestModule,
|
2017-04-27 18:49:50 +00:00
|
|
|
} = ReactNative.NativeModules;
|
|
|
|
|
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class SyncMethodTest extends React.Component<{}> {
|
2017-04-27 18:49:50 +00:00
|
|
|
componentDidMount() {
|
2017-05-06 03:50:47 +00:00
|
|
|
if (RNTesterTestModule.echoString('test string value') !== 'test string value') {
|
2017-04-27 18:49:50 +00:00
|
|
|
throw new Error('Something wrong with sync method export');
|
|
|
|
}
|
2017-05-06 03:50:47 +00:00
|
|
|
if (RNTesterTestModule.methodThatReturnsNil() != null) {
|
2017-04-27 18:49:50 +00:00
|
|
|
throw new Error('Something wrong with sync method export');
|
|
|
|
}
|
|
|
|
TestModule.markTestCompleted();
|
|
|
|
}
|
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
render(): React.Node {
|
2017-04-27 18:49:50 +00:00
|
|
|
return <View />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SyncMethodTest.displayName = 'SyncMethodTest';
|
|
|
|
|
|
|
|
module.exports = SyncMethodTest;
|