Skip to content

Commit 8679926

Browse files
committed
Udated NativeMethodsMixin with new lifecycle hooks
1 parent 2868176 commit 8679926

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/react-native-renderer/src/NativeMethodsMixin.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ if (__DEV__) {
187187
const NativeMethodsMixin_DEV = (NativeMethodsMixin: any);
188188
invariant(
189189
!NativeMethodsMixin_DEV.componentWillMount &&
190-
!NativeMethodsMixin_DEV.componentWillReceiveProps,
190+
!NativeMethodsMixin_DEV.componentWillReceiveProps &&
191+
!NativeMethodsMixin_DEV.unsafe_componentWillMount &&
192+
!NativeMethodsMixin_DEV.unsafe_componentWillReceiveProps,
191193
'Do not override existing functions.',
192194
);
193195
NativeMethodsMixin_DEV.componentWillMount = function() {
@@ -196,6 +198,12 @@ if (__DEV__) {
196198
NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) {
197199
throwOnStylesProp(this, newProps);
198200
};
201+
NativeMethodsMixin_DEV.unsafe_componentWillMount = function() {
202+
throwOnStylesProp(this, this.props);
203+
};
204+
NativeMethodsMixin_DEV.unsafe_componentWillReceiveProps = function(newProps) {
205+
throwOnStylesProp(this, newProps);
206+
};
199207
}
200208

201209
export default NativeMethodsMixin;

0 commit comments

Comments
 (0)