์ฅ๋ฉด ์ ํ ์ ๊ธฐ๋ณธ ์คํ๋ง ์ ๋๋ฉ์ด์ ์ด ์์๋ณด๋ค ์ฝ๊ฐ ๋๋ ค์ ์ฌ์ฉ์ ์ง์ ์ ๋๋ฉ์ด์ ์ ๋ง๋ค๊ณ ์ฌ์ฉํ ์ ์๋์ง ๊ถ๊ธํฉ๋๋ค. ๋ชจ๋ ํฌ์ธํฐ๋ฅผ ์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
์๋ ํ์ธ์, ์ฌ๊ธฐ์์ rtl ์ธ์ด(์: ์๋์ด, ์ ํ์ด ์ค๋ฅธ์ชฝ์์ ์ผ์ชฝ์ผ๋ก ์ด๋ฃจ์ด์ง๋๋ก)๋ฅผ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค.
rtlAwareAnimation(pos, navState) {
const factor = I18n.rtl() ? -1 : 1;
Animated.spring(
pos,
{
bounciness: 0,
toValue: factor*navState.index,
}
).start();
},
render() {
return (
<Router>
<Scene key="signIn" component={SignIn} title={I18n.t('signIn')} initial={true} applyAnimation={this.rtlAwareAnimation} />
<Scene key="dashboard" component={Dashboard}applyAnimation={this.rtlAwareAnimation} />
</Router>
);
๊ทธ๋ฌ๋ ์ฅ๋ฉด์ด ํน๋ณํ ์์น์ ๋ฐฐ์น๋๋ฏ๋ก ์ ํ ๋ฐฉํฅ์ด ๋ค์ ์ฅ๋ฉด์ด ์๋ ์์น์ ์ผ์นํด์ผ ํ๋ฏ๋ก ์ฌ์ ํ ์ ์ฉํ์ง ์์ต๋๋ค.
์์์ ์๋๋ก ๋๋ ๊ทธ ๋ฐ๋๋ก ์ด๋ป๊ฒ ๋ ๊น์? 1์ฐจ์๋ง ์ฒ๋ฆฌํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ค์ ์ด๋ฏธ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค. ๊ธฐ๋ณธ์ ์ผ๋ก ๋ฐฉํฅ์ด rightToLeft์ด๊ธฐ ๋๋ฌธ์ direction
์์ฑ์ ์ ๊ณตํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค.
import { I18nManager } from 'react-native'
let directionSide = I18nManager.isRTL ? 'leftToRight' : null
<Scene key='xXXXX' component={XXXXX} title='XXXXX' direction={directionSide}/>