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
|
|
|
*
|
2018-05-10 22:44:55 +00:00
|
|
|
* @format
|
2017-04-27 18:49:50 +00:00
|
|
|
* @flow
|
|
|
|
*/
|
2018-05-10 22:44:55 +00:00
|
|
|
|
2017-04-27 18:49:50 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react');
|
|
|
|
var ReactNative = require('react-native');
|
2018-05-10 22:44:55 +00:00
|
|
|
var {View} = ReactNative;
|
2017-04-27 18:49:50 +00:00
|
|
|
|
2018-05-10 22:44:55 +00:00
|
|
|
const {TestModule, RNTesterTestModule} = ReactNative.NativeModules;
|
2017-04-27 18:49:50 +00:00
|
|
|
|
2017-08-18 01:36:54 +00:00
|
|
|
class SyncMethodTest extends React.Component<{}> {
|
2017-04-27 18:49:50 +00:00
|
|
|
componentDidMount() {
|
2018-05-10 22:44:55 +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;
|