Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nandorojo/zeego
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a57e24ea6d0853844a76b6877330c35e323c57e4
Choose a base ref
...
head repository: nandorojo/zeego
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 12, 2025

  1. fix hirbod's issue

    nandorojo committed Mar 12, 2025
    Copy the full SHA
    c38e4e6 View commit details
  2. tweak logic

    nandorojo committed Mar 12, 2025
    Copy the full SHA
    7d7e19b View commit details
Showing with 61 additions and 5 deletions.
  1. +1 −1 packages/zeego/package.json
  2. +30 −2 packages/zeego/src/menu/create-android-menu/index.android.tsx
  3. +30 −2 packages/zeego/src/menu/create-ios-menu/index.ios.tsx
2 changes: 1 addition & 1 deletion packages/zeego/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zeego",
"version": "3.0.3",
"version": "3.0.4",
"description": "Logical UI primitives, made for screens.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
32 changes: 30 additions & 2 deletions packages/zeego/src/menu/create-android-menu/index.android.tsx
Original file line number Diff line number Diff line change
@@ -220,10 +220,38 @@ If you want to use a custom component as your <Content />, you can use the creat
ItemTitle
).targetChildren

const maybeTitle =
let maybeTitle =
child.props.textValue ?? titleChild?.[0]?.props.children

if (typeof maybeTitle == 'string') {
if (Array.isArray(maybeTitle)) {
/**
* Use case: <ItemTitle>Here is some {text}</ItemTitle>
* React will turn that into ['Here is some ', text] as an array
* So we need to 1) detect that it's all strings and 2) join them together
*/
let stringTitle = ''
let isString = false

for (let i = 0; i < maybeTitle.length; i++) {
const text = maybeTitle[i]
if (text == null) {
continue
}
if (typeof text == 'string' || typeof text == 'number') {
stringTitle += text
isString = true
} else {
isString = false
break
}
}

if (isString) {
maybeTitle = stringTitle
}
}

if (typeof maybeTitle === 'string') {
title = maybeTitle
} else {
console.error(
32 changes: 30 additions & 2 deletions packages/zeego/src/menu/create-ios-menu/index.ios.tsx
Original file line number Diff line number Diff line change
@@ -216,10 +216,38 @@ If you want to use a custom component as your <Content />, you can use the creat
ItemTitle
).targetChildren

const maybeTitle =
let maybeTitle =
child.props.textValue ?? titleChild?.[0]?.props.children

if (typeof maybeTitle == 'string') {
if (Array.isArray(maybeTitle)) {
/**
* Use case: <ItemTitle>Here is some {text}</ItemTitle>
* React will turn that into ['Here is some ', text] as an array
* So we need to 1) detect that it's all strings and 2) join them together
*/
let stringTitle = ''
let isString = false

for (let i = 0; i < maybeTitle.length; i++) {
const text = maybeTitle[i]
if (text == null) {
continue
}
if (typeof text == 'string' || typeof text == 'number') {
stringTitle += text
isString = true
} else {
isString = false
break
}
}

if (isString) {
maybeTitle = stringTitle
}
}

if (typeof maybeTitle === 'string') {
title = maybeTitle
} else {
console.error(