Created
March 3, 2016 20:27
-
-
Save neciu/391127f1f70b3eb69adf to your computer and use it in GitHub Desktop.
NavigatorSceneConfig fixing issue: https://github.com/facebook/react-native/issues/1655
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Dimensions, | |
PixelRatio, | |
Navigator, | |
} from 'react-native'; | |
import buildStyleInterpolator from 'react-native/Libraries/Utilities/buildStyleInterpolator'; | |
const SCREEN_WIDTH = Dimensions.get('window').width; | |
const FromTheRight = { | |
opacity: { | |
value: 1.0, | |
type: 'constant', | |
}, | |
transformTranslate: { | |
from: {x: SCREEN_WIDTH, y: 0, z: 0}, | |
to: {x: 0, y: 0, z: 0}, | |
min: 0, | |
max: 1, | |
type: 'linear', | |
extrapolate: true, | |
round: PixelRatio.get(), | |
}, | |
translateX: { | |
from: SCREEN_WIDTH, | |
to: 0, | |
min: 0, | |
max: 1, | |
type: 'linear', | |
extrapolate: true, | |
round: PixelRatio.get(), | |
}, | |
scaleX: { | |
value: 1, | |
type: 'constant', | |
}, | |
scaleY: { | |
value: 1, | |
type: 'constant', | |
}, | |
}; | |
const ToTheLeftIOS = { | |
transformTranslate: { | |
from: {x: 0, y: 0, z: 0}, | |
to: {x: -SCREEN_WIDTH*0.3, y: 0, z: 0}, | |
min: 0, | |
max: 1, | |
type: 'linear', | |
extrapolate: true, | |
round: PixelRatio.get(), | |
}, | |
opacity: { | |
value: 1.0, | |
type: 'constant', | |
}, | |
}; | |
export default { | |
...Navigator.SceneConfigs.PushFromRight, | |
animationInterpolators: { | |
into: buildStyleInterpolator(FromTheRight), | |
out: buildStyleInterpolator(ToTheLeftIOS), | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment