@controleonline/ui-common 1.2.91 → 1.2.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": "1.2.93",
3
+ "rc": 1,
4
+ "branch": "rc/1.2.93-rc.1",
5
+ "baseMaster": "b4db94eb1ccd3bf878dc96e3d32c0249aad07402",
6
+ "tasks": [77],
7
+ "repositories": { "ControleOnline/ui-common": "4dfdb2d7ccb160f265115bdad3125d6ecd26bdfd" },
8
+ "compositionNotes": ["Verified on Android emulator: Text width was still 0 with flexBasis auto because Yoga prioritises flex over flexGrow/flexBasis. flex:0 fixes it."],
9
+ "frozen": true
10
+ }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@controleonline/ui-common",
3
- "version": "1.2.91",
3
+ "version": "1.2.93",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline Common Quasar UI Component",
6
6
  "license": "MIT",
7
7
  "main": "src/react/index.js",
8
8
  "scripts": {
9
- "test": "npm run test:receita-federal && npm run test:imports-status && npm run test:runtime-language && npm run test:runtime-footer && npm run test:runtime-footer-marquee && npm run test:invoice-presentation && npm run test:system-error-message && npm run test:bottom-navigation-toolbar && npm run test:copy-device-configs && npm run test:print-routing && npm run test:device-detail-dependencies",
9
+ "test": "npm run test:receita-federal && npm run test:imports-status && npm run test:runtime-language && npm run test:runtime-footer && npm run test:runtime-footer-marquee && npm run test:invoice-presentation && npm run test:system-error-message && npm run test:bottom-navigation-toolbar && npm run test:copy-device-configs && npm run test:print-routing && npm run test:device-detail-dependencies && npm run test:runtime-zoom",
10
10
  "test:receita-federal": "node --test src/tests/react/pages/receitaFederalIntegrationContract.test.mjs",
11
11
  "test:imports-status": "mkdir -p node_modules/@controleonline && rm -rf node_modules/@controleonline/ui-common && ln -s ../.. node_modules/@controleonline/ui-common && node --test src/tests/react/utils/importStatus.test.js",
12
12
  "test:runtime-language": "node --test src/tests/react/utils/runtimeLanguage.test.js",
@@ -18,7 +18,8 @@
18
18
  "test:copy-device-configs": "node --test src/tests/react/utils/copyDeviceConfigs.test.mjs",
19
19
  "test:print-routing": "node --test src/tests/react/utils/printRouting.test.mjs src/tests/react/utils/printSpoolUtils.test.mjs",
20
20
  "test:runtime-footer-marquee": "node --test src/tests/react/components/RuntimeFooterMarqueeText.test.js src/tests/react/components/RuntimeFooterMarqueeText.build.test.js",
21
- "test:device-detail-dependencies": "node --test src/tests/react/pages/deviceDetailLoaderDependencies.test.mjs"
21
+ "test:device-detail-dependencies": "node --test src/tests/react/pages/deviceDetailLoaderDependencies.test.mjs",
22
+ "test:runtime-zoom": "node --test src/tests/react/utils/runtimeZoom.test.js"
22
23
  },
23
24
  "devDependencies": {
24
25
  "c8": "^10.1.3",
@@ -172,12 +172,26 @@ export const DefaultProvider = ({
172
172
  deviceInfo: device || {},
173
173
  });
174
174
  const {width: windowWidth, height: windowHeight} = useWindowDimensions();
175
+ // app-community#1051: size the scaled content from the area it really
176
+ // occupies (shell minus runtime footer), not from the full window.
177
+ const [contentSize, setContentSize] = useState(null);
178
+ const handleContentLayout = useCallback(({nativeEvent}) => {
179
+ const {width, height} = nativeEvent?.layout || {};
180
+ setContentSize(current =>
181
+ current?.width === width && current?.height === height
182
+ ? current
183
+ : {width, height},
184
+ );
185
+ }, []);
175
186
  const runtimeUiScaleStyle = useMemo(
176
187
  () =>
177
188
  buildRuntimeZoomStyle(APP_ENV?.ZOOM, {
178
- viewport: {width: windowWidth, height: windowHeight},
189
+ viewport: {
190
+ width: contentSize?.width || windowWidth,
191
+ height: contentSize?.height || windowHeight,
192
+ },
179
193
  }),
180
- [windowHeight, windowWidth],
194
+ [contentSize, windowHeight, windowWidth],
181
195
  );
182
196
  const deviceConfigPeopleIri = resolveDeviceConfigPeopleIri({
183
197
  appType,
@@ -371,7 +385,15 @@ export const DefaultProvider = ({
371
385
  backgroundColor: colors?.background || runtimeColors.background,
372
386
  },
373
387
  ]}>
374
- <View style={[providerStyles.content, runtimeUiScaleStyle]}>{children}</View>
388
+ <View
389
+ style={providerStyles.content}
390
+ onLayout={runtimeUiScaleStyle ? handleContentLayout : undefined}>
391
+ {runtimeUiScaleStyle ? (
392
+ <View style={runtimeUiScaleStyle}>{children}</View>
393
+ ) : (
394
+ children
395
+ )}
396
+ </View>
375
397
  {!isShopClientApp && bottomNavigationCount === 0 && (
376
398
  <RuntimeInfoFooter
377
399
  appVersion={appVersion}
@@ -105,6 +105,13 @@ const RuntimeFooterMarqueeText = props => {
105
105
  color: color,
106
106
  flexShrink: 0,
107
107
  flexGrow: 0,
108
+ // primaryText carries `flex: 1` (flexBasis 0 on native), which collapsed
109
+ // the Text to width 0 inside the row on Android. Force intrinsic sizing.
110
+ // Yoga gives `flex` precedence over flexGrow/flexBasis, so the inherited
111
+ // `flex: 1` must be overridden explicitly or the Text stays at width 0.
112
+ flex: 0,
113
+ flexBasis: 'auto',
114
+ minWidth: 0,
108
115
  minHeight: 14,
109
116
  },
110
117
  ];
@@ -164,6 +171,7 @@ const RuntimeFooterMarqueeText = props => {
164
171
  alignItems: 'center',
165
172
  opacity: 1,
166
173
  transform: [{translateX: translateX}],
174
+ justifyContent: shouldMarquee ? 'flex-start' : 'center',
167
175
  alignSelf: shouldMarquee ? 'flex-start' : 'stretch',
168
176
  },
169
177
  },
@@ -37,10 +37,16 @@ export const buildRuntimeZoomStyle = (
37
37
  }
38
38
 
39
39
  const inverseScale = 1 / scale;
40
+ // app-community#1051: the container also carries `flex: 1` (flexBasis 0),
41
+ // which overrides the compensated height. Disable flex sizing so the
42
+ // compensated size survives and the scaled content fills the viewport.
40
43
  const nativeBase = {
41
44
  transform: [{scale}],
42
45
  transformOrigin: 'top left',
43
46
  alignSelf: 'flex-start',
47
+ flexGrow: 0,
48
+ flexShrink: 0,
49
+ flexBasis: 'auto',
44
50
  };
45
51
 
46
52
  const viewportWidth = Number(viewport?.width);
@@ -169,3 +169,27 @@ test('long text enables marquee duplicate and starts loop animation', async () =
169
169
  assert.ok(lastLoopConfig, 'Animated.loop should start when overflowing');
170
170
  assert.ok(animationStarts >= 1);
171
171
  });
172
+
173
+ test('native text keeps intrinsic width even when style carries flex: 1 (android #77)', () => {
174
+ const RuntimeFooterMarqueeText = loadComponent();
175
+ const renderer = require('react-test-renderer');
176
+
177
+ let tree;
178
+ renderer.act(() => {
179
+ tree = renderer.create(
180
+ React.createElement(RuntimeFooterMarqueeText, {
181
+ text: 'Samsung • DEVICE / v1.10.55',
182
+ color: '#111',
183
+ style: {flex: 1, minWidth: 0, fontSize: 11},
184
+ }),
185
+ );
186
+ });
187
+
188
+ const text = tree.root.findAllByType('Text')[0];
189
+ const flat = Object.assign({}, ...[].concat(text.props.style));
190
+ // Yoga gives `flex` precedence: it must not stay at the inherited 1 (width 0 on Android).
191
+ assert.equal(flat.flex, 0);
192
+ assert.equal(flat.flexBasis, 'auto');
193
+ assert.equal(flat.flexGrow, 0);
194
+ assert.equal(flat.flexShrink, 0);
195
+ });
@@ -31,6 +31,9 @@ test('builds compensated container dimensions for native scaled content', () =>
31
31
  buildRuntimeZoomStyle(70),
32
32
  {
33
33
  alignSelf: 'flex-start',
34
+ flexBasis: 'auto',
35
+ flexGrow: 0,
36
+ flexShrink: 0,
34
37
  height: '142.85714285714286%',
35
38
  transform: [{scale: 0.7}],
36
39
  transformOrigin: 'top left',
@@ -44,6 +47,9 @@ test('uses viewport pixels on native so scale origin stays top-left without dist
44
47
  buildRuntimeZoomStyle(70, {viewport: {width: 360, height: 800}}),
45
48
  {
46
49
  alignSelf: 'flex-start',
50
+ flexBasis: 'auto',
51
+ flexGrow: 0,
52
+ flexShrink: 0,
47
53
  height: 800 / 0.7,
48
54
  transform: [{scale: 0.7}],
49
55
  transformOrigin: 'top left',