Skip to content

Commit

Permalink
Udated NativeMethodsMixin with new lifecycle hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Jan 16, 2018
1 parent 2868176 commit 8679926
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/react-native-renderer/src/NativeMethodsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ if (__DEV__) {
const NativeMethodsMixin_DEV = (NativeMethodsMixin: any);
invariant(
!NativeMethodsMixin_DEV.componentWillMount &&
!NativeMethodsMixin_DEV.componentWillReceiveProps,
!NativeMethodsMixin_DEV.componentWillReceiveProps &&
!NativeMethodsMixin_DEV.unsafe_componentWillMount &&
!NativeMethodsMixin_DEV.unsafe_componentWillReceiveProps,
'Do not override existing functions.',
);
NativeMethodsMixin_DEV.componentWillMount = function() {
Expand All @@ -196,6 +198,12 @@ if (__DEV__) {
NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) {
throwOnStylesProp(this, newProps);
};
NativeMethodsMixin_DEV.unsafe_componentWillMount = function() {
throwOnStylesProp(this, this.props);
};
NativeMethodsMixin_DEV.unsafe_componentWillReceiveProps = function(newProps) {
throwOnStylesProp(this, newProps);
};
}

export default NativeMethodsMixin;

0 comments on commit 8679926

Please sign in to comment.