Я использую реагирующую нативную для разработки приложения, но я пытаюсь вызвать функцию setConf () из моего приложения. js, но, видимо, React не распознает document , который находится в файле Script. js, когда я импортирую этот js, как вызвать функцию без проблем с документом? Спасибо
Ошибка: ReactNative JS: ReferenceError: Не удается найти переменную: document
import React from 'react';
import {
StyleSheet,
Text,
Button,
View
} from 'react-native';
import WebView from 'react-native-webview';
import {
Colors
} from 'react-native/Libraries/NewAppScreen';
import setConf from './Script'
setConf();
const App: () => React$Node = () => {
return(
<WebView
originWhitelist={['*']}
source={{uri: "file:///android_asset/widget/index.html"}}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
/>
);
};
const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter,
},
engine: {
position: 'absolute',
right: 0,
},
body: {
backgroundColor: Colors.white,
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black,
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
color: Colors.dark,
},
highlight: {
fontWeight: '700',
},
footer: {
color: Colors.dark,
fontSize: 12,
fontWeight: '600',
padding: 4,
paddingRight: 12,
textAlign: 'right',
},
});
export default App;
Сценарий. js
var form = document.querySelector(".form-composer");
form.addEventListener("submit", setData);
export function setConf() {
var Id = 1;
...
}
...