最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - (NOBRIDGE) WARN [Layout children]: No route named "inspection[projectId][itemId]" exists in nested child

programmeradmin7浏览0评论

(NOBRIDGE) WARN [Layout children]: No route named "inspection/[projectId]/[itemId]" exists in nested children: ["+not-found", "login", "new-project", "_sitemap", "(auth)", "(tabs)", "add-item/[projectId]", "inspection-details/[id]", "inspection", "project/[id]"] [Component Stack]

/inspection/[projectId]/[itemId].tsx

export default function InspectionScreen() {
  const { projectId, itemId } = useLocalSearchParams();
  const router = useRouter();
  
  const [itemName, setItemName] = useState('');
  const [serialNumber, setSerialNumber] = useState<string | null>(null);
  const [isScannerVisible, setIsScannerVisible] = useState(false);
  const [hasPermission, setHasPermission] = useState<boolean | null>(null);
  const [scanned, setScanned] = useState(false);
  const [isLoading, setIsLoading] = useState(true);
  const [questions, setQuestions] = useState<Question[]>([]);
  const [answers, setAnswers] = useState<Answer[]>([]);
  const [isSaving, setIsSaving] = useState(false);
  const [refreshing, setRefreshing] = useState(false);

  // Memoize the loadData function to prevent unnecessary recreations
  const loadData = useCallback(async () => {
    if (!projectId || !itemId) return;

    try {
      setIsLoading(true);
      
      // Fetch item details
      const item = await db.getItem(itemId as string);
      if (item) {
        setItemName(item.name);
        setSerialNumber(item.serial_number);
      }

Here is the directory structure of my app: Directory tree

This is how I call the item inspection to save

      Alert.alert(
        'Success',
        `Inspection ${status} successfully`,
        [{ 
          text: 'OK', 
          onPress: () => {
            router.push({
              pathname: '/project/[id]',
              params: { id: projectId as string, refresh: 'true' }
            });
          }
        }]
      );

This is my code to access the item inspection in

project/[id].tsx

<View style={styles.itemActions}>
          <TouchableOpacity 
            style={styles.itemActionButton}
            onPress={() => router.push(`/inspection/${id}/${item.id}`)}
          >
            <Edit size={16} color="#007AFF" />
            <Text style={styles.itemActionText}>Inspect</Text>
          </TouchableOpacity>

I have tried creating a new _layout.tsx for the folder [projectId] but still nothing.

It displays the correct item to inspect on web, but whenever I go to Expo Go, it shows "This screen doesn't exist."

Please help!

Any help would be amazing!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论