react native ScrollView滾動不起作用
在做頁面初始化時, 想ScrollView跳轉到指定的位置,結果發現程式碼執行了,卻沒有跳到指定的位置,程式碼如下。
componentDidMount(){
scrollView.scrollTo({x: 0, y: 0, animated: true})
}
經過大量查詢各種資料,發現在ScrollView初始化時有個動畫效果,只有動畫結束了,呼叫scrollView.scrollTo才有效果,官方資料沒有說明這點
我們可以這樣做,在componentDidMount()里加一個延時操作就可以了。其實Flatlist也有同樣的問題。解決辦法一樣
componentDidMount() { this.fristTime = setTimeout(() => { ScrollView.scrollTo({x: 0, y: 0, animated: true}) }, 0) }
相關推薦
react native ScrollView滾動不起作用
在做頁面初始化時, 想ScrollView跳轉到指定的位置,結果發現程式碼執行了,卻沒有跳到指定的位置,程式碼如下。 componentDidMount(){
scrollview smoothScrollTo不起作用的問題
LinearLayout ll = (LinearLayout) findViewById(R.id.ll); final ScrollView hsv = (ScrollView) findViewById(R.id.hsv); OnGlobalLayoutLis
【Flume】【原始碼分析】flume中sink到hdfs,檔案系統頻繁產生檔案,檔案滾動配置不起作用?
本人在測試hdfs的sink,發現sink端的檔案滾動配置項起不到任何作用,配置如下: a1.sinks.k1.type=hdfs a1.sinks.k1.channel=c1 a1.sinks.k1.hdfs.useLocalTimeStamp=true a1.sink
flume的sink端檔案滾動配置項不起作用
1.flume滾動配置為何不起作用? 2.通過原始碼分析得出什麼原因? 3.該如何解決flume小檔案? 本人在測試hdfs的sink,發現sink端的檔案滾動配置項起不到任何作用,配置如下: [Bash shell] 純文字檢視 複製程式
設定ScrollView 裡面的佈局高度為match_parent不起作用
xml: <ScrollView android:id="@+id/sv" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="
Android中scrollview的scrollto方法不起作用的辦法
ScrollView 為一些沒有滾動條的view 提供滾動條, 方法就是把需要滾動條的view 包含在 <ScrollView> 裡面. 在Activity 的 onCreate() 方法(貌似在onStart和onResume也一樣)中, 呼叫 m
react native Scrollview在某些時候滾動無效
react native Scrollview在某些時候滾動無效 今
react初學點選事件不起作用
學習react的時候發現點選事件沒有起作用,最後發現是onClick事件裡C沒有大寫 <button onClick = {increate}>點選 </button>
react native scrollview深入詳解觸控滾動事件
大家都知道scrollview的幾個屬性和方法:詳細的方法請參考: 這裡我就講解下scrollview的觸控和滑動順序,並講解下scrollview的幾個觸控方法 1、幾個已知的滑動或者滑動開始結束的方法: onScroll:在滾動過程中, 每幀最多呼叫一次此函式
解決ScrollView滑動過程中ScrollTo()方法不起作用的問題
原文 本篇文章作為新的類別 “Android經驗之談” 開篇之作,記錄實際開發中遇到的比較“奇怪”的問題以及解決方案,不求長篇大論,但求短小精悍,一兩句話講明問題及解決方案,畫龍點睛,一語道破天機。 有時候,一句提醒,能讓人豁然開朗,少走很多彎路。 案例:閱讀軟
導致spring事務配置不起作用的一種原因
red something 事務配置 nbsp oid -s color con bsp @Component public class AnalyticsApplication { @Autowired private InitializationAc
textArea中的placeholder屬性不起作用
問題 img tex text tro pan str ext textarea 問題描述: textarea中加的placeholder屬性有給值,但是在jsp頁面中沒有對應的提示信息顯示,如下圖所示: 原因: <textarea>與</texta
AutoCAD 許可管理器不起作用,或未正確安裝,現在將關閉
選擇 分享 log eight src ref 問題 通過 重新安裝 問題描述 重新安裝了也還是這樣,而且第二次打開都跳不出申請碼界面就關閉了。 問題原因,初步認為:AutoCAD 在首次彈出申請激活類型的類型時,直接選擇了網絡激活,而且沒有激活成功。再
SpringBoot學習遇到的問題(1) - 配置文件有日誌的debug模式等配置項,為什麽不起作用
boot lease bug fig spa stack 不起作用 網站 cat 這個問題困擾我近乎兩天,通過查找N多資料後終於解決,寫下來共享給大家。 logging.level.root=DEBUG ... 一系列的日誌配置項,都不起作用的原因是springboot啟動
left outer join的on不起作用
oci join microsoft nbsp mysq soft sel asp msdn left outer join的on不起作用 https://msdn.microsoft.com/zh-cn/library/ms177634.aspx?f=255&am
CSS 中first-child和last-child不起作用原因
clas 第一個 元素 col 沒有 XML last 發的 n) 今天開發的時候,發現last-child不起作用,看了下原因順便給自己學習CSS選擇器,我們這裏舉個例子,如下代碼:<div><h1>title</h1> <p&g
鼠標滾輪圖片放大縮小功能,使用layer彈框後不起作用
src con ext 顯示 想是 它的 max msg 隨著 今天在項目中遇到的一個問題:點擊按鈕使用layer彈框彈出一張圖片,需要加一個鼠標滾輪放大縮小,圖片也跟著放大縮小的功能。於是在網上找了一個demo。 DEMO: 1 <!DOCTYPE html P
vue雙向綁定時添加.sync不起作用的原因
component 2.0 雙向 例子 不同 版本 name 但是 vue <my-component v-bind:my-name.sync="name" v-bind:my-age.sync="age"></my-component> 以上代碼是
ios微信瀏覽器click事件不起作用的解決方法
ont func 手機 alert 微信 搜索 pan font js代碼 $(document).on( "click", ".weui_cell", functi
Linux下,PHP的SESSION不起作用的問題
lin mod data article trac ack tracking track rac 改動SESSION目錄的權限就能夠了。 先找到SESSION目錄, 然後 chmod -R 777 /var/lib/php/session 假設沒有此目錄