-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with TextField floating placeholder offset when it includes…
… a leading accessory (#1700)
- Loading branch information
Showing
9 changed files
with
72 additions
and
6 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,15 @@ | ||
/// <reference types="react" /> | ||
import { View as RNView } from 'react-native'; | ||
interface Measurements { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
pageX: number; | ||
pageY: number; | ||
} | ||
declare const _default: () => { | ||
ref: import("react").MutableRefObject<RNView | undefined>; | ||
measurements: Measurements | undefined; | ||
}; | ||
export default _default; |
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
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,35 @@ | ||
import {useEffect, useRef, useState} from 'react'; | ||
import {MeasureOnSuccessCallback, View as RNView} from 'react-native'; | ||
|
||
interface Measurements { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
pageX: number; | ||
pageY: number; | ||
} | ||
|
||
export default () => { | ||
const ref = useRef<RNView>(); | ||
const [measurements, setMeasurements] = useState<Measurements | undefined>(); | ||
|
||
const onMeasure: MeasureOnSuccessCallback = (x, y, width, height, pageX, pageY) => { | ||
setMeasurements({ | ||
x, | ||
y, | ||
width, | ||
height, | ||
pageX, | ||
pageY | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
setTimeout(() => { | ||
ref.current?.measure?.(onMeasure); | ||
}, 0); | ||
}, []); | ||
|
||
return {ref, measurements}; | ||
}; |
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