MCPcopy
hub / github.com/callstack/react-native-paper / getChildrenMeasures

Function getChildrenMeasures

src/components/Tooltip/utils.ts:93–123  ·  view source on GitHub ↗
(
  style: StyleProp<ViewStyle>,
  measures: ChildrenMeasurement
)

Source from the content-addressed store, hash-verified

91};
92
93const getChildrenMeasures = (
94 style: StyleProp<ViewStyle>,
95 measures: ChildrenMeasurement
96): ChildrenMeasurement => {
97 const { position, top, bottom, left, right } = StyleSheet.flatten(style);
98
99 if (position === 'absolute') {
100 let pageX = 0;
101 let pageY = measures.pageY;
102 let height = 0;
103 let width = 0;
104 if (typeof left === 'number') {
105 pageX = left;
106 width = 0;
107 }
108 if (typeof right === 'number') {
109 pageX = measures.width - right;
110 width = 0;
111 }
112 if (typeof top === 'number') {
113 pageY = pageY + top;
114 }
115 if (typeof bottom === 'number') {
116 pageY = pageY - bottom;
117 }
118
119 return { pageX, pageY, width, height };
120 }
121
122 return measures;
123};
124
125export const getTooltipPosition = (
126 { children, tooltip, measured }: Measurement,

Callers 1

getTooltipPositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…