这是我第一次使用测试版技术,所以也许这是可以预料的,我现在应该忽略这些错误吗?我对 Next.js 也非常陌生。
我已经跑去npx create-next-app@latest front --typescript -
为我的应用程序代码创建一个新目录(将我的 API 分开,因为还有一个电子应用程序需要与其通信)。
我选择“否”来使用该src/
目录。
我为实验/app
目录选择了yes。
当询问有关配置导入别名时,我只是单击 Enter 并跳过。
当项目构建完成后,我运行npm run dev
并发现了 3 个开箱即用的错误。
错误是-
其中两个:
Error: Hydration failed because the initial UI does not match what was rendered on the server.
Warning: Expected server HTML to contain a matching <main> in <body>.
See more info here: https://nextjs.org/docs/messages/react-hydration-error
Run Code Online (Sandbox Code Playgroud)
其中之一:
Error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the …
Run Code Online (Sandbox Code Playgroud) 当我尝试从 VScode 推送到 GitHub 时,我不断收到此错误。我之前已经按照我现在正在遵循的完全相同的步骤推送到该存储库。找不到此错误原因的答案?
我有一个提要片段,它的主要元素是帖子的 RecyclerView。
我正在使用 Lisa Wray 的 Groupie 库管理回收器 https://github.com/lisawray/groupie
现在在我的导航图中,我有一个将提要片段连接到另一个片段的操作,我尝试使用我在适配器的绑定函数中创建的点击侦听器来调用此操作。
val action=FeedFragmentDirections.actionDestinationFeedToDestinationAddToBucket(image.id)
findNavController().navigate(action)
Run Code Online (Sandbox Code Playgroud)
我一直收到一个错误说 navigation destination XXXXX is unknown to this NavController
我试过在findNavController()
, like viewHolder.itemView
or之前添加一些东西,viewHolder.root
但没有任何效果。
当我使用时,viewHolder.itemView.rootView
我收到此错误,而不是View DecorView@a190adf[MainActivity] does not have a NavController set
我不知道 DecorView 是什么。
任何想法如何正确实施我的 oncick 听众?
navigation android-recyclerview android-architecture-navigation
我已经在一些方面使用Firebase,但是现在我想添加Crashlytics,并且在指南的第3步中说:“对于Android应用程序,AndroidManifest.xml文件中的钩子会自动初始化Firebase SDK。”
我实际上需要做些什么吗?
我面临一个问题,我可以看到有人在博客上提出的建议,据说可以帮助他们解决同样的问题。建议删除 .Gradle 和 .idea 文件夹中的所有内容,然后重新同步 gradle 并重建所有内容。
我是个初学者,从来没有做过这样的事情,所以我害怕任何我不知道后果的破坏性行为。这个操作有什么可怕的吗,或者这些文件会再次重新生成吗?
如果一切都好,那么如何正确完成呢?通过探索者?或者通过 Android Studio?
谢谢!
我基本上需要在图像中创建这个设计。我知道可以用 CSS 来实现,但我不知道如何实现。我尝试用谷歌搜索它,但我只能找到像这样的精致的“太阳”设计,这对于我目前的理解来说太多了,无法分解。
https://codepen.io/zmmbreeze/pen/guLfC
我已经创建了这样的中心部分(使用 sass):
&__count {
width: 12rem;
height: 12rem;
color: $lightPurple;
border: $border;
font-size: 4rem;
font-weight: 500;
border-radius: 100%;
@include centerContent;
}
Run Code Online (Sandbox Code Playgroud)
如何添加“光线”?
这是我试图提取的内容:
.count-down {
position: relative;
margin: auto;
@include centerContent;
&__count {
width: 12rem;
height: 12rem;
color: $lightPurple;
border: $border;
font-size: 4rem;
font-weight: 500;
border-radius: 100%;
@include centerContent;
}
&__go {
width: 15rem;
height: 15rem;
color: white;
border: 1px solid white;
font-size: 4rem;
font-weight: 500;
border-radius: 100%;
@include centerContent;
}
}
.sun-light b,
.sun-light s …
Run Code Online (Sandbox Code Playgroud) 我刚刚了解到React.memo()
并想知道,我们什么时候不想要这种行为?我们不是总是希望组件仅在其 props 发生更改时才重新渲染吗?
我想在一个活动中拥有三个 navHostFragment,它们都占用相同的空间,但每个都托管不同的导航图。然后使用片段管理器和底部导航栏,我想在需要时显示每个(并隐藏其他),并以这种方式保持用户在每个图中的当前位置。
我目前在尝试在一项活动中使用其中 3 个时遇到问题,我收到此错误:
Caused by: java.lang.IllegalArgumentException: Binary XML file line #38: Duplicate id 0x7f0a0086, tag container_fragment, or parent id 0xffffffff with another fragment for androidx.navigation.fragment.NavHostFragment
这是我的 xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FeedActivity">
<androidx.appcompat.widget.Toolbar
android:layout_width="0dp"
android:layout_height="wrap_content"
android:theme="@style/MyActionBar"
android:minHeight="?attr/actionBarSize"
android:id="@+id/my_toolbar"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<fragment
android:id="@+id/feed_nav_host_fragment"
android:tag="container_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_height="0dp"
app:defaultNavHost="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@+id/feed_bottom_nav"
app:navGraph="@navigation/feed_nav_graph"
android:layout_width="0dp"
app:layout_constraintTop_toBottomOf="@+id/my_toolbar"
/>
<fragment
android:id="@+id/board_nav_host_fragment2"
android:tag="container_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_height="0dp"
app:defaultNavHost="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@+id/feed_bottom_nav"
app:navGraph="@navigation/board_nav_graph"
android:layout_width="0dp"
app:layout_constraintTop_toBottomOf="@+id/my_toolbar"
/>
<fragment
android:id="@+id/profile_nav_host_fragment3"
android:tag="container_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_height="0dp"
app:defaultNavHost="false" …
Run Code Online (Sandbox Code Playgroud) navigation android android-navigation jitpack android-architecture-navigation
我正在尝试第一次在我的应用中实现转换,但此消息不断崩溃
Restarter must be created only during owner's initialization stage transition
这就是我添加片段的方式:
activity.subFm.beginTransaction()
.setCustomAnimations(
R.anim.slide_in_up,
R.anim.slide_out_down,
R.anim.slide_in_up,
R.anim.slide_out_down
)
.replace(R.id.feed_subcontents_frame_container, activity.searchFragment, "searchFragment")
.addToBackStack("searchFragment").commit()
Run Code Online (Sandbox Code Playgroud)
我也尝试过这样:
activity.subFm.beginTransaction()
.setCustomAnimations(
R.anim.slide_in_up,
R.anim.slide_out_down,
R.anim.slide_in_up,
R.anim.slide_out_down
)
.add(R.id.feed_subcontents_frame_container, activity.searchFragment, "searchFragment")
.addToBackStack("searchFragment").commit()
Run Code Online (Sandbox Code Playgroud)
发生的情况是该片段已成功启动并已过渡,但是存在两个问题。
当我不使用交易时,一切工作正常。当单击后退按钮时,我只是弹出后退堆栈,因此可以在打开和关闭片段之间永久地来回移动。但是,一旦添加此交易,它就会中断。
我看过这篇文章,人们建议切换到appcompat:1.1.0-beta01或1.0.2,但实际上我已经使用过这两种方法。我尝试删除枯萎并运行该应用程序,但仍然崩溃。我究竟做错了什么?我只是想实现一个简单的slide_in和slide_out动画。
滑入:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%p"
android:toYDelta="0%p"/>
</set>
Run Code Online (Sandbox Code Playgroud)
滑出:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0"
android:toYDelta="-100%" />
</set>
Run Code Online (Sandbox Code Playgroud) animation android android-fragments android-transitions material-components-android
我正在尝试构建我的第一个组件库。按照指南,我只是启动了一个新的空 npm 项目,将 rollup 添加为构建器,并开始在 src 目录(在组件文件夹中)中添加所有组件。
当尝试给 Storybook 做广告时,它说:We were not able to detect the right builder for your project. Please select one:
并让我在 Vite 或 Webpack 5 之间进行选择,但两者都不是。我应该怎么办?其中一个应该比另一个工作得更好吗?他们都会引起问题吗?
android ×4
android-architecture-navigation ×2
navigation ×2
reactjs ×2
animation ×1
crashlytics ×1
css ×1
css-shapes ×1
firebase ×1
git ×1
github ×1
gradle ×1
jitpack ×1
material-components-android ×1
next.js ×1
rollup ×1
storybook ×1
vite ×1
webpack ×1