-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from heap/develop
Cut 0.22.4 release
- Loading branch information
Showing
22 changed files
with
255 additions
and
112 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
class Switch extends React.Component<Props> { | ||
_handleChange = (event: SwitchChangeEvent) => { | ||
if (this._nativeSwitchRef == null) { | ||
return; | ||
} | ||
|
||
// Force value of native switch in order to control it. | ||
const value = this.props.value === true; | ||
if (Platform.OS === 'android') { | ||
this._nativeSwitchRef.setNativeProps({on: value}); | ||
} else { | ||
this._nativeSwitchRef.setNativeProps({value}); | ||
} | ||
|
||
if (this.props.onChange != null) { | ||
this.props.onChange(event); | ||
} | ||
|
||
if (this.props.onValueChange != null) { | ||
this.props.onValueChange(event.nativeEvent.value); | ||
} | ||
}; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
|
||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var Switch = function (_React$Component) { | ||
(0, _inherits2["default"])(Switch, _React$Component); | ||
var _super = _createSuper(Switch); | ||
function Switch() { | ||
var _this; | ||
(0, _classCallCheck2["default"])(this, Switch); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this._handleChange = function (e) { | ||
var Heap = require('@heap/react-native-heap')["default"]; | ||
Heap.autotrackSwitchChange("change", _this, e); | ||
(function (event) { | ||
if (_this._nativeSwitchRef == null) { | ||
return; | ||
} | ||
var value = _this.props.value === true; | ||
if (Platform.OS === 'android') { | ||
_this._nativeSwitchRef.setNativeProps({ | ||
on: value | ||
}); | ||
} else { | ||
_this._nativeSwitchRef.setNativeProps({ | ||
value: value | ||
}); | ||
} | ||
if (_this.props.onChange != null) { | ||
_this.props.onChange(event); | ||
} | ||
if (_this.props.onValueChange != null) { | ||
_this.props.onValueChange(event.nativeEvent.value); | ||
} | ||
}).call(_this, e); | ||
}; | ||
return _this; | ||
} | ||
return (0, _createClass2["default"])(Switch); | ||
}(React.Component); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,6 @@ | ||
'use strict'; | ||
|
||
class Switch extends React.Component<Props> { | ||
_handleChange = (event: SwitchChangeEvent) => { | ||
if (this._nativeSwitchRef == null) { | ||
return; | ||
} | ||
|
||
// Force value of native switch in order to control it. | ||
const value = this.props.value === true; | ||
if (Platform.OS === 'android') { | ||
this._nativeSwitchRef.setNativeProps({on: value}); | ||
} else { | ||
this._nativeSwitchRef.setNativeProps({value}); | ||
} | ||
|
||
if (this.props.onChange != null) { | ||
this.props.onChange(event); | ||
} | ||
|
||
if (this.props.onValueChange != null) { | ||
this.props.onValueChange(event.nativeEvent.value); | ||
} | ||
}; | ||
} | ||
const SwitchWithForwardedRef: React.AbstractComponent< | ||
Props, | ||
React.ElementRef< | ||
typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent, | ||
>, | ||
> = React.forwardRef(function Switch(props, forwardedRef): React.Node {}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,12 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } | ||
var Switch = function (_React$Component) { | ||
(0, _inherits2["default"])(Switch, _React$Component); | ||
var _super = _createSuper(Switch); | ||
function Switch() { | ||
var _this; | ||
(0, _classCallCheck2["default"])(this, Switch); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this._handleChange = function (e) { | ||
var Heap = require('@heap/react-native-heap')["default"]; | ||
Heap.autotrackSwitchChange("change", _this, e); | ||
(function (event) { | ||
if (_this._nativeSwitchRef == null) { | ||
return; | ||
} | ||
var value = _this.props.value === true; | ||
if (Platform.OS === 'android') { | ||
_this._nativeSwitchRef.setNativeProps({ | ||
on: value | ||
}); | ||
} else { | ||
_this._nativeSwitchRef.setNativeProps({ | ||
value: value | ||
}); | ||
} | ||
if (_this.props.onChange != null) { | ||
_this.props.onChange(event); | ||
} | ||
if (_this.props.onValueChange != null) { | ||
_this.props.onValueChange(event.nativeEvent.value); | ||
} | ||
}).call(_this, e); | ||
}; | ||
return _this; | ||
var SwitchWithForwardedRef = (require('@heap/react-native-heap')["default"] || { | ||
withHeapSwitchAutocapture: function withHeapSwitchAutocapture(Component) { | ||
return Component; | ||
} | ||
return (0, _createClass2["default"])(Switch); | ||
}(React.Component); | ||
}).withHeapSwitchAutocapture(function (Component, displayName) { | ||
if (Component && displayName) { | ||
Component.displayName = displayName; | ||
} | ||
return Component; | ||
}(React.forwardRef(function Switch(props, forwardedRef) {}), "Switch")); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: [ | ||
'add-react-displayname', | ||
'./node_modules/@heap/react-native-heap/instrumentor/src/index.js', | ||
], | ||
module.exports = (api) => { | ||
api.cache(false); | ||
|
||
return { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: [ | ||
'add-react-displayname', | ||
'./node_modules/@heap/react-native-heap/instrumentor/src/index.js', | ||
], | ||
}; | ||
}; |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
module.exports = { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: [ | ||
'add-react-displayname', | ||
'./node_modules/@heap/react-native-heap/instrumentor/src/index.js', | ||
], | ||
module.exports = api => { | ||
api.cache(false); | ||
|
||
return { | ||
presets: ['module:metro-react-native-babel-preset'], | ||
plugins: [ | ||
'add-react-displayname', | ||
'./node_modules/@heap/react-native-heap/instrumentor/src/index.js', | ||
], | ||
}; | ||
}; |
This file contains 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
Oops, something went wrong.