react-native-web
Advanced tools
Comparing version 0.19.8 to 0.19.9
@@ -185,2 +185,10 @@ "use strict"; | ||
var hostRef = React.useRef(null); | ||
var prevSelection = React.useRef(null); | ||
var prevSecureTextEntry = React.useRef(false); | ||
React.useEffect(() => { | ||
if (hostRef.current && prevSelection.current) { | ||
setSelection(hostRef.current, prevSelection.current); | ||
} | ||
prevSecureTextEntry.current = secureTextEntry; | ||
}, [secureTextEntry]); | ||
var handleContentSizeChange = React.useCallback(hostNode => { | ||
@@ -289,15 +297,19 @@ if (multiline && onContentSizeChange && hostNode != null) { | ||
function handleSelectionChange(e) { | ||
if (onSelectionChange) { | ||
try { | ||
var node = e.target; | ||
var selectionStart = node.selectionStart, | ||
selectionEnd = node.selectionEnd; | ||
e.nativeEvent.selection = { | ||
start: selectionStart, | ||
end: selectionEnd | ||
}; | ||
try { | ||
var _e$target = e.target, | ||
selectionStart = _e$target.selectionStart, | ||
selectionEnd = _e$target.selectionEnd; | ||
var _selection = { | ||
start: selectionStart, | ||
end: selectionEnd | ||
}; | ||
if (onSelectionChange) { | ||
e.nativeEvent.selection = _selection; | ||
e.nativeEvent.text = e.target.value; | ||
onSelectionChange(e); | ||
} catch (e) {} | ||
} | ||
} | ||
if (prevSecureTextEntry.current === secureTextEntry) { | ||
prevSelection.current = _selection; | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -304,0 +316,0 @@ (0, _useLayoutEffect.default)(() => { |
@@ -180,2 +180,10 @@ /** | ||
var hostRef = React.useRef(null); | ||
var prevSelection = React.useRef(null); | ||
var prevSecureTextEntry = React.useRef(false); | ||
React.useEffect(() => { | ||
if (hostRef.current && prevSelection.current) { | ||
setSelection(hostRef.current, prevSelection.current); | ||
} | ||
prevSecureTextEntry.current = secureTextEntry; | ||
}, [secureTextEntry]); | ||
var handleContentSizeChange = React.useCallback(hostNode => { | ||
@@ -284,15 +292,19 @@ if (multiline && onContentSizeChange && hostNode != null) { | ||
function handleSelectionChange(e) { | ||
if (onSelectionChange) { | ||
try { | ||
var node = e.target; | ||
var selectionStart = node.selectionStart, | ||
selectionEnd = node.selectionEnd; | ||
e.nativeEvent.selection = { | ||
start: selectionStart, | ||
end: selectionEnd | ||
}; | ||
try { | ||
var _e$target = e.target, | ||
selectionStart = _e$target.selectionStart, | ||
selectionEnd = _e$target.selectionEnd; | ||
var _selection = { | ||
start: selectionStart, | ||
end: selectionEnd | ||
}; | ||
if (onSelectionChange) { | ||
e.nativeEvent.selection = _selection; | ||
e.nativeEvent.text = e.target.value; | ||
onSelectionChange(e); | ||
} catch (e) {} | ||
} | ||
} | ||
if (prevSecureTextEntry.current === secureTextEntry) { | ||
prevSelection.current = _selection; | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -299,0 +311,0 @@ useLayoutEffect(() => { |
@@ -6,3 +6,3 @@ { | ||
"name": "react-native-web", | ||
"version": "0.19.8", | ||
"version": "0.19.9", | ||
"description": "React Native for Web", | ||
@@ -9,0 +9,0 @@ "module": "dist/index.js", |
@@ -196,3 +196,12 @@ /** | ||
const hostRef = React.useRef(null); | ||
const prevSelection = React.useRef(null); | ||
const prevSecureTextEntry = React.useRef(false); | ||
React.useEffect(() => { | ||
if (hostRef.current && prevSelection.current) { | ||
setSelection(hostRef.current, prevSelection.current); | ||
} | ||
prevSecureTextEntry.current = secureTextEntry; | ||
}, [secureTextEntry]); | ||
const handleContentSizeChange = React.useCallback( | ||
@@ -328,14 +337,17 @@ (hostNode) => { | ||
function handleSelectionChange(e) { | ||
if (onSelectionChange) { | ||
try { | ||
const node = e.target; | ||
const { selectionStart, selectionEnd } = node; | ||
e.nativeEvent.selection = { | ||
start: selectionStart, | ||
end: selectionEnd | ||
}; | ||
try { | ||
const { selectionStart, selectionEnd } = e.target; | ||
const selection = { | ||
start: selectionStart, | ||
end: selectionEnd | ||
}; | ||
if (onSelectionChange) { | ||
e.nativeEvent.selection = selection; | ||
e.nativeEvent.text = e.target.value; | ||
onSelectionChange(e); | ||
} catch (e) {} | ||
} | ||
} | ||
if (prevSecureTextEntry.current === secureTextEntry) { | ||
prevSelection.current = selection; | ||
} | ||
} catch (e) {} | ||
} | ||
@@ -342,0 +354,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2954493
69401