NITRO WEBVIEW / REACT NATIVE
Nitro Modules๋ก ๋ง๋ React Native WebView. ์ต์ํ ์น ์ฝํ ์ธ ๋ฅผ ํ์ ์ด ์๋ ์ฝ๋ฐฑ๊ณผ ๋ค์ดํฐ๋ธ API๋ก ์ฐ๊ฒฐํ์ธ์.
iOS ยท Android ยท New Architecture
WEB โ REACT NATIVE
WebView๋ฅผ ๋ ๋๋งํ๊ณ ํ์ด์ง์ ๋ฉ์์ง๋ฅผ ๋ฐ์ผ์ธ์. ์ฝ๋ฐฑ์ callback()์ผ๋ก ๊ฐ์๋๋ค.
์ฒซ WebView ๋ง๋ค๊ธฐimport { NitroWebView, callback } from 'nitro-webview'
const html = `
<h1>Hello, Nitro</h1>
<script>
window.ReactNativeWebView.postMessage('hello from the web')
</script>
`
export default function Screen() {
return (
<NitroWebView
style={{ flex: 1 }}
source={{ html, baseUrl: 'https://app.example.com' }}
onMessage={callback(({ nativeEvent }) => {
console.log(nativeEvent.data)
})}
/>
)
}onMessagehello from the webDOCUMENTATION
๋งํฌ, ์ ์ฐฝ, ๋ค๋ก ๊ฐ๊ธฐ๋ฅผ ์ฑ์ ํ๋ฆ์ ์ฐ๊ฒฐํ์ธ์.
ํ์ด์ง์ ๋ฉ์์ง๋ฅผ ์ฃผ๊ณ ๋ฐ๊ณ ๋ค์ดํฐ๋ธ ๋ฐ์ ์ ๋ณด๋ฅผ ํ์ธํ์ธ์.
ํ๋ซํผ๋ณ cookie store์ iOS ๋น๊ณต๊ฐ ์ธ์ ์ ์ดํดํ์ธ์.
Props, ๋ฉ์๋, ์ด๋ฒคํธ์ ํ๋ซํผ๋ณ ์ฐจ์ด๋ฅผ ํ์ธํ์ธ์.
ํ๋ซํผ๋ง๋ค ๋ค๋ฅธ ๋์, ๋ฌธ์์์ ๋จผ์ ํ์ธํ์ธ์.
ํ๋ซํผ ์ง์ ํ์ธ